{********************************************************}
{                                                        }
{                 Zeos Database Objects                  }
{              Sybase SQL Transaction component          }
{                                                        }
{       Copyright (c) 1999-2001 Sergey Seroukhov         }
{    Copyright (c) 1999-2002 Zeos Development Group      }
{                                                        }
{********************************************************}

unit ZSySqlTr;

interface

{$R *.dcr}

uses
  Classes, ZDirSySql, ZSySqlCon, ZTransact, ZSqlTypes;

{$IFNDEF LINUX}
{$INCLUDE ..\Zeos.inc}
{$ELSE}
{$INCLUDE ../Zeos.inc}
{$ENDIF}

type
  { Sybase SQL transaction }
  TZZSySqlTransact = class(TZZTransact)
  private
    function  GetDatabase: TZZSySqlDatabase;
    procedure SetDatabase(Value: TZZSySqlDatabase);
  public
    constructor Create(AOwner: TComponent); override;

    procedure AddMonitor(Monitor: TZZMonitor); override;
    procedure DeleteMonitor(Monitor: TZZMonitor); override;
  published
    property Database: TZZSySqlDatabase read GetDatabase write SetDatabase;
    property TransactSafe;
  end;

implementation

{***************** TZZSySqlTransact implementation *****************}

{ Class constructor }
constructor TZZSySqlTransact.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FHandle := TDirSySQLTransact.Create(nil);
  FQuery  := TDirSySQLQuery.Create(nil, TDirSySQLTransact(FHandle));
  FDatabaseType := dtMSSQL;
end;

{ Get database component }
function TZZSySqlTransact.GetDatabase: TZZSySqlDatabase;
begin
  Result := TZZSySqlDatabase(FDatabase);
end;

{ Set database component }
procedure TZZSySqlTransact.SetDatabase(Value: TZZSySqlDatabase);
begin
  inherited SetDatabase(Value);
end;

{ Add monitor into monitor list }
procedure TZZSySqlTransact.AddMonitor(Monitor: TZZMonitor);
begin
  ZDirSySql.MonitorList.AddMonitor(Monitor);
end;

{ Delete monitor from monitor list }
procedure TZZSySqlTransact.DeleteMonitor(Monitor: TZZMonitor);
begin
  ZDirSySql.MonitorList.DeleteMonitor(Monitor);
end;

end.
